package system

import (
	"context"
	"gf_blog_admin/internal/model"
	"gf_blog_admin/internal/service"
	"github.com/gogf/gf/v2/os/gtime"
)

type sSysTask struct{}

func init() {
	service.RegisterSysTask(NewSysTask())
}

func NewSysTask() *sSysTask {
	return &sSysTask{}
}

func (s *sSysTask) List(ctx context.Context) (out []*model.TaskListItem, err error) {
	out = make([]*model.TaskListItem, 0)
	out = append(out, &model.TaskListItem{
		Id:         100,
		CreateDate: gtime.New("2022-06-13 17:04:55"),
		Result:     "",
		State:      0,
		StateName:  "执行中",
		TaskName:   "年度报表生成",
		Type:       "report",
	})
	out = append(out, &model.TaskListItem{
		Id:         101,
		CreateDate: gtime.New("2022-06-12 09:31:08"),
		Result:     "https://www.baidu.com",
		State:      1,
		StateName:  "完成",
		TaskName:   "系统日志导出",
		Type:       "export",
	})
	return
}
